﻿namespace XsqTech.SmartOA.Application.ServiceExtensions
{
    /// <summary>
    /// 扩展方法怎么写？--静态的类，静态的方法，第一个参数 this开头，this后面跟上一个类型的名字
    /// </summary>
    public static class SwaggerSetupExt
    {
        public static void AddSwaggerSetup(this IServiceCollection services)
        {
            services.AddSwaggerGen(x =>
            {
                //var basePath = Path.GetDirectoryName(typeof(Program).Assembly.Location);  //获取应用程序的运行目录
                var basePath = AppContext.BaseDirectory;
                var xmlPath = Path.Combine(basePath, "XsqTech.SmartOA.Application.xml"); //拼接XML文件所在路径
                //Swagger注释
                x.IncludeXmlComments(xmlPath, true);
            });
        }
    }
}
